
#include <sys/cdefs.h>
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include "namespace.h"
#include <assert.h>
#include <string.h>
#else
#include <lib/libkern/libkern.h>
#endif

__strong_alias(index, strchr)
char *
strchr(const char *p, int ch)
{
	const char cmp = ch;
	_DIAGASSERT(p != NULL);

	for (;; ++p) {
		if (*p == cmp) {
			/* LINTED const cast-away */
			return(__UNCONST(p));
		}
		if (!*p)
			return(NULL);
	}
	/* NOTREACHED */
}
